﻿#include<iostream>
using namespace std;

char* ReadRef(const char* ref, const char* cmds);

int main(int count, char* arc[]) {
	char* id{}, * pass{}, * country{};
	const char* idRef{ "id:" };
	const char* passRef{ "pass:" };
	const char* countryRef{ "country:" };
	cout << &countryRef[3] << endl;//ntry:

	char a[10]{ "country:" };
	cout << &a << endl;//000000B2692FF748
	cout << &a[0] << endl;//country:
	cout << &a[3] << endl;//ntry:

	for (int i = 1; arc[i]; i++) {
		if (id == nullptr) {
			id = ReadRef(idRef, arc[i]);
			if (id != nullptr)continue;
		}
		if (pass == nullptr) {
			pass = ReadRef(passRef, arc[i]);
			if (pass != nullptr)continue;
		}
		if (country == nullptr) {
			country = ReadRef(countryRef, arc[i]);
			if (country != nullptr)continue;
		}
	}
	if ((int)id * (int)pass * (int)country) {
		cout << "账号：" << id;
		cout << "密码：" << pass;
		cout << "国家：" << country;
	}
	else {
		cout << "请使用命令的方式调用本程序 输入/?查看帮助！" << endl;
	}
}

char* ReadRef(const char* ref, const char* cmds) {
	for (int i = 0; cmds[i]; i++) {
		if (cmds[i] == ref[0]) {
			bool bfind = true;
			int x;
			for (x = 0; ref[x]; x++) {
				if (ref[x] != cmds[i + x]) {
					bfind = false;
					break;
				}
			}
			cout << &cmds[i + x] << endl;
			if (bfind)return (char*)&cmds[i + x];
		}
	}
	return nullptr;
}